<div class="content_filtro">
    <div class="filtro">
        <form id="form_filtro" method="post" action="">
            <i>Filtrar</i>
            <label><?php echo elemform::radio('stfiltro','stfiltro','1',$this->stfiltro); ?> Ativo</label>
            <label><?php echo elemform::radio('stfiltro','stfiltro','0',$this->stfiltro); ?> Inativo</label>
            
            &nbsp;
            
            <?php

                $query = 'SELECT SQL_CACHE CBS_ID,CBS_NOM FROM CURSOBASE WHERE CBS_STA = 1';
                $f_cur = $this->db->fetchAll($query);
                        
                $html = '<select id="itfiltro" name="itfiltro" class="chosen-select" >';
                $html .= '<option value="">Todos</option>';
                foreach($f_cur as $r){   
                    $select = $this->itfiltro == $r['CBS_ID'] ? 'selected':''; 
                    $html .= '<option '.$select.' value="'.$r['CBS_ID'].'">'.$r['CBS_NOM'].'</option>'; 
                }
                $html .= '</select>';
                echo $html;
            ?>
            
            &nbsp;
            
            <input type="text" name="anfiltro" placeholder="Ano" maxlength="4" class="data_a" value="<?php echo $this->anfiltro?>" />
            
            <input type="submit" class="btn-pdr" name="buscar" value="buscar" />
        </form>
    </div>
    
    <?php if($this->per_add){?>
    <div class="content-btn">
        <span>Novo</span><a href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit','id'=>'')); ?>">+</a>
    </div>
    <?php } ?>
    
</div>

<div class="content-list">
    
    <h2><?php echo $this->titulo;?></h2>
    
    <table id="tlist">
        <thead>
            <tr>
                <th>Nome</th>
                <th width="80px">Turno</th>
                <th>Turma</th>
                <th width="50px">Ano</th>
                <th width="50px">Semestre</th>
                <th width="80px"> Qtd / Vagas</th>
                <th class="bc">&nbsp;</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($this->result as $row) { 
                /*
                $curso = new Admin_Model_DbTable_Cursobase();
                $curso = $curso->fetchRow('CBS_ID = '.$row['CBS_ID);
                
                $turma = '';
                if($row['CUR_TRM'] > 0){
                    $tur = new Admin_Model_DbTable_Numeroturma();
                    $tur = $tur->fetchRow('NRT_ID = '.$row['CUR_TRM']);
                    if(isset($tur['NRT_NOM'])) $turma = $tur['NRT_NOM'];
                }
                 */
            ?>
                <tr>
                    <td align="left"><?php echo $row['CBS_NOM']; //$row['CUR_NOM; ?></td>
                    <td align="left"><?php echo dominio::getTurno($row['TUR_ID']); ?></td>
                    <td align="left"><?php echo $row['NRT_NOM']; //$row['CUR_TRM; ?></td>
                    <td align="left"><?php echo $row['CUR_ANO']; ?></td>
                    <td align="left"><?php echo dominio::getSemestres($row['CUR_SEM']); ?></td>
                    <td align="left"><?php echo Operacoes::matriculasCurso($row['CUR_ID']); ?> / <?php echo $row['CUR_NMRMAXALU']; ?></td>
                    <td class="bc">
                        <?php if($this->per_edt){?><a class="btn-pdr" href="<?php echo $this->url(array('controller' => $this->controller, 'action' => 'edit', 'id' => $row['CUR_ID'])); ?>">Editar</a><?php }?>
                        <?php if($this->per_del && $row['CUR_STA'] == 0){?><a class="btn-pdr" href="javascript:void(0);" onclick="list_delete('<?php echo $this->controller; ?>', <?php echo $row['CUR_ID'] ?>, $(this));">Deletar</a><?php } ?>
                    </td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
</div>
<?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml'); ?>